#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Created on 2022-04-02 11:17:04
@author: DengLibin 榆霖
@description: 删除低方差的特征(对结果影响不大的特征)
'''

import pandas as pd
from sklearn.feature_selection import VarianceThreshold


def demo():
    data = pd.read_csv('dating.csv')
    # 只要前三列
    data = data.iloc[:, :3]
    # threshold 阈值(调整阈值查看结果的列数（特征数）)
    transfer = VarianceThreshold(threshold=5)
    
    new_data = transfer.fit_transform(data)
    print(new_data.shape)
    
if __name__ == '__main__':
   demo()
